]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/network: Add timestamp to device items
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 3 Aug 2022 16:12:31 +0000 (18:12 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 10 Aug 2022 12:17:19 +0000 (12:17 +0000)
Devices do not have an associated timestamp, but as we can now
track the MRU order of their connections, it makes sense to consider
the time of the most recent succesful connection the timestamp
of the device item.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>

js/ui/status/network.js

index 66c65b434b6dca000447f210fb4eefb5c3bf7e33..d1b4baba31ba58bcd27967422c0af9316a8db11b 100644 (file)
@@ -437,7 +437,7 @@ const NMDeviceItem = GObject.registerClass({
         this._deviceName = '';
 
         this._connectionItems = new Map();
-        this._itemSorter = new ItemSorter();
+        this._itemSorter = new ItemSorter({trackMru: true});
 
         // Item shown in the 0-connections case
         this._autoConnectItem =
@@ -470,6 +470,11 @@ const NMDeviceItem = GObject.registerClass({
         this._activeConnectionChanged();
     }
 
+    get timestamp() {
+        const [item] = this._itemSorter.itemsByMru();
+        return item?.timestamp ?? 0;
+    }
+
     _canReachInternet() {
         if (this._client.primary_connection !== this._device.active_connection)
             return true;